package schoolword;

import java.io.File;
import java.io.IOException;

public class Test2 {
    public static void main(String[] args) throws IOException {
        File file = new File("D:\\代码码云仓库Java\\step-onto-java-programming\\2024-5-29\\src\\schoolword\\aa");
        deleteFile(file);

    }

    private static void deleteFile(File file) {
        if (file.isDirectory()) {  //如果是目录
            File[] files = file.listFiles();
            if (files != null) {
                for (File f : files) {
                    deleteFile(f);
                }
            }
        }

        file.delete();
    }
}
